R Spark basics

This notebook is a very simple check with Spark R


In [ ]:
# Load the SparkR package. 
# It will likely show a few warnings about functions that the package overrides
library(SparkR)

In [ ]:
# In the IRkernel we do not have an automatically created Spark Session, as in Python & Scala. 
# We need to initialize the kernel to fetch one. That takes a few moments.
sc <- sparkR.session( "local[*]" );

In [ ]:
# Do something to prove it works

# Load one of the standard datasets that come pre-packaged with R
data(iris)

# Turn the dataset into an SparkR DataFrame
df <- as.DataFrame(iris)

In [ ]:
# Inspect it
head( filter(df, df$Petal_Width > 0.2) )

In [ ]: